<template>
  <div class="app-container">
    <!-- banner列表 -->
    <el-table :data="list" stripe style="width: 100%">
      <el-table-column type="index" width="50" label="序号" />
      <el-table-column prop="assetId" label="资产链上编号" />
      <el-table-column prop="assetName" label="资产名称" />
      <el-table-column prop="assetType" label="资产类型" />
      <el-table-column prop="assetValue" label="资产价值" />
      <el-table-column prop="assetDescription" label="具体描述" />
      <el-table-column prop="assetTerm" label="资产期限" />
      <el-table-column prop="createTime" label="创建时间" />
      <el-table-column prop="updateTime" label="更新时间" />
    </el-table>
  </div>
</template>

<script>
// 时间显示问题
import asset from '@/api/asset'

export default {
  data() {
    return {
      list: []
    }
  },
  created() {
    this.findAllAsset()
  },
  methods: {
    findAllAsset() {
      asset
        .findAllAsset()
        .then((response) => {
          var temp = response.data
          for (let i = 0; i < temp.length; i++) {
            temp[i].createTime = this.timeFormatConversion(temp[i].createTime)
            temp[i].updateTime = this.timeFormatConversion(temp[i].updateTime)
          }
          this.list = temp
        })
        .catch((error) => {
          console.log(error)
        })
    },
    // 因为你时间传过来的是一个string，这里格式转换就是对字符串操作，如果你后端传过来格式是yyyy-mm-dd HH:MM:ss格式的就不用转换了
    timeFormatConversion(date) {
      return date.slice(0, 10) + ' ' + date.slice(11, 19)
    }
  }

}
</script>
